/**
 * jims
 */
package com.jims.master.modules.sync.service;
import com.jims.master.common.persistence.Page;
import com.jims.master.common.service.CrudService;
import com.jims.master.modules.sync.dao.DrugClassDictDao;
import com.jims.master.modules.sync.dao.DrugNameDictDao;
import com.jims.master.modules.sync.entity.DrugNameDict;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * 药品名称字典Service
 *
 * @author 朱齐
 * @version 2017-03-01
 */
@Service
@Transactional(readOnly = true)
public class DrugNameDictService extends CrudService<DrugNameDictDao, DrugNameDict> {
    @Autowired
    private DrugClassDictDao drugClassDictDao;


    public List<DrugNameDict> selectDrug(DrugNameDict drugNameDict) {
        return dao.selectDrug(drugNameDict);
    }

    /**
     * 根据药品字典来过滤药品信息
     * @param page
     * @param drugNameDict
     * @return
     */
    public Page<DrugNameDict> findPageByDict(Page<DrugNameDict> page, DrugNameDict drugNameDict) {
        drugNameDict.setPage(page);
        page.setList(dao.findPageByDict(drugNameDict));
        return page;
    }


    public DrugNameDict findByDrugCode(String drugCode) {
        return dao.findByDrugCode(drugCode);
    }
    /**
     * 加载药品列表
     * @param drugNameDict
     * @return
     * @author
     */
    public List<DrugNameDict> getDrugNameList(DrugNameDict drugNameDict) {
        return dao.getDrugNameList(drugNameDict);
    }


}